/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.payment.entity;

import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.modules.base.entity.cars.Tcar;
import com.jeesite.modules.base.entity.fixedexpense.FixedExpense;
import org.hibernate.validator.constraints.Length;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;

/**
 * 应付单Entity
 * @author mr
 * @version 2021-03-11
 */
@Table(name="t_ap_detail", alias="a", columns={
		@Column(name="ap_detail_id", attrName="apDetailId", label="应付单明细ID", isPK=true),
		@Column(name="brand", attrName="brand", label="品牌"),
		@Column(name="area", attrName="area", label="版型"),
		@Column(name="model", attrName="model", label="车型"),
		@Column(name="car_id", attrName="carId", label="车辆"),
		@Column(name="pay_left", attrName="payLeft", label="剩余应付"),
		@Column(name="frame_number", attrName="frameNumber", label="车架号",queryType=QueryType.LIKE),
		@Column(name="expense_item", attrName="expenseItem", label="费用项目"),
		@Column(name="ap_amount", attrName="apAmount", label="应付金额", comment="应付金额（人民币）", isQuery=false),
		@Column(name="actual_ap_amount", attrName="actualApAmount", label="实付金额", comment="实付金额（人民币）", isQuery=false),
		@Column(name="remarik", attrName="remarik", label="备注", isQuery=false),
		@Column(name="ap_id", attrName="apId.apId", label="应付单ID"),
		@Column(name="row_number", attrName="rowNumber", label="服务订单行号"),
	}, joinTable = {
		@JoinTable(type = JoinTable.Type.LEFT_JOIN, entity = FixedExpense.class, attrName = "fixedExpense", alias = "b",
				on = "b.fixed_expense_id = a.expense_item", columns = {
				@Column(name = "fixed_expense_id", label = "项目费用id", isPK = true),
				@Column(name = "fixed_expense_name", label = "项目费用名称"),
		}),
		@JoinTable(type = JoinTable.Type.LEFT_JOIN, entity = Tcar.class, attrName = "car", alias = "c",
				on = "a.car_id = c.car_id", columns = {
				@Column(name = "car_id", label = "车辆id", isPK = true),
				@Column(name = "car_name", label = "车辆名称"),
		}),
		@JoinTable(type = JoinTable.Type.LEFT_JOIN,entity = Tap.class, attrName = "apId" ,alias = "d",
				on = "a.ap_id = d.ap_id", columns = {
				@Column(name = "ap_id", label = "应付主表id", isPK = true),
				@Column(name = "uuid", label = "日记账生成uuid"),

		})
}, orderBy="a.ap_detail_id ASC"
)
public class TapDetail extends DataEntity<TapDetail> {

	private static final long serialVersionUID = 1L;
	private String apDetailId;		// 应付单明细ID
	private String brand;		// 品牌
	private String area;		// 版型
	private String model;		// 车型
	private String carId;		// 车辆
	private Tcar car;
	private String frameNumber;		// 车架号
	private String expenseItem;		// 费用项目
	private FixedExpense fixedExpense;
	private Double apAmount;		// 应付金额（人民币）
	private Double actualApAmount;		// 实付金额（人民币）
	private String remarik;		// 备注
	private Tap apId;		// 应付单ID 父类
	private String apCode;   //临时字段，付款选择使用
	private String expenseItemName;//临时字段,费用类型名字
	private Long rowNumber;		// 服务订单行号
    private Double payLeft;

	public Double getPayLeft() {
		return payLeft;
	}

	public void setPayLeft(Double payLeft) {
		this.payLeft = payLeft;
	}

	public Long getRowNumber() {
		return rowNumber;
	}

	public void setRowNumber(Long rowNumber) {
		this.rowNumber = rowNumber;
	}


	public Tcar getCar() {
		return car;
	}

	public void setCar(Tcar car) {
		this.car = car;
	}

	public TapDetail() {
		this(null);
	}

	public FixedExpense getFixedExpense() {
		return fixedExpense;
	}

	public void setFixedExpense(FixedExpense fixedExpense) {
		this.fixedExpense = fixedExpense;
	}

	public String getExpenseItemName() {
		return expenseItemName;
	}

	public void setExpenseItemName(String expenseItemName) {
		this.expenseItemName = expenseItemName;
	}

	public String getApCode() {
		return apCode;
	}

	public void setApCode(String apCode) {
		this.apCode = apCode;
	}

	public TapDetail(Tap apId){
		this.apId = apId;
	}

	public String getApDetailId() {
		return apDetailId;
	}

	public void setApDetailId(String apDetailId) {
		this.apDetailId = apDetailId;
	}

	@Length(min=0, max=2, message="品牌长度不能超过 2 个字符")
	public String getBrand() {
		return brand;
	}

	public void setBrand(String brand) {
		this.brand = brand;
	}

	@Length(min=0, max=64, message="版型长度不能超过 64 个字符")
	public String getArea() {
		return area;
	}

	public void setArea(String area) {
		this.area = area;
	}

	@Length(min=0, max=100, message="车型长度不能超过 100 个字符")
	public String getModel() {
		return model;
	}

	public void setModel(String model) {
		this.model = model;
	}

	@Length(min=0, max=64, message="车辆长度不能超过 64 个字符")
	public String getCarId() {
		return carId;
	}

	public void setCarId(String carId) {
		this.carId = carId;
	}

	@Length(min=0, max=100, message="车架号长度不能超过 100 个字符")
	public String getFrameNumber() {
		return frameNumber;
	}

	public void setFrameNumber(String frameNumber) {
		this.frameNumber = frameNumber;
	}

	@Length(min=0, max=100, message="费用项目长度不能超过 100 个字符")
	public String getExpenseItem() {
		return expenseItem;
	}

	public void setExpenseItem(String expenseItem) {
		this.expenseItem = expenseItem;
	}

	public Double getApAmount() {
		return apAmount;
	}

	public void setApAmount(Double apAmount) {
		this.apAmount = apAmount;
	}

	public Double getActualApAmount() {
		return actualApAmount;
	}

	public void setActualApAmount(Double actualApAmount) {
		this.actualApAmount = actualApAmount;
	}

	@Length(min=0, max=255, message="备注长度不能超过 255 个字符")
	public String getRemarik() {
		return remarik;
	}

	public void setRemarik(String remarik) {
		this.remarik = remarik;
	}

	@Length(min=0, max=64, message="应付单ID长度不能超过 64 个字符")
	public Tap getApId() {
		return apId;
	}

	public void setApId(Tap apId) {
		this.apId = apId;
	}

}
